package com.runssnail.huafeiduo.api;

import com.runssnail.huafeiduo.api.common.Lifecycle;
import com.runssnail.huafeiduo.api.exception.ApiException;
import com.runssnail.huafeiduo.api.request.Request;
import com.runssnail.huafeiduo.api.response.Response;

/**
 * 微信api client，所有请求都从这里发起
 *
 * @author zhengwei
 */
public interface HuaFeiDuoClient extends Lifecycle {

    /**
     * apiKey
     *
     * @return apiKey
     */
    String getApiKey();

    /**
     * secretKey
     *
     * @return 返回secretKey
     */
    String getSecretKey();

    /**
     * 请求
     *
     * @param req 请求对象
     * @param <R>
     * @return
     * @throws ApiException
     */
    <R extends Response> R execute(Request<R> req) throws ApiException;

}
